<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="author" content="wangbo">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>jsx语法</title>
</head>
<body>
    <div id="app"></div>
    <script type="text/javascript" src="../js/react.development.js"></script>
    <script type="text/javascript" src="../js/react-dom.development.js"></script>
    <script type="text/javascript" src="../js/babel.min.js"></script>
    <script type="text/babel">
    // 定义一个类
    const myurl={
        baidu:'https://www.baidu.com',
        taobao:"https://taobao.com"
    }
    const tag={
        baidu:'百度',
        taobao:"淘宝"
    }
    function chg(tag) {
        if (tag=='百度') {
            return myurl.baidu
        } else {
            return myurl.taobao
        }
    }
    // 属性里边使用js方法
        // const myp = <a href={myurl.baidu}>我用的是百度</a>
        const myp = <a href={chg(tag.taobao)}>我用的是{tag.taobao}</a>
        ReactDOM.render(myp,document.getElementById('app'))
    </script>

    
</body>
</html>